import request from '@/utils/request'


// 搜索文章
export function searchArticle(keyword,pageNum,pageSize) {
  return request({
    url:'/article/search/' + keyword  + '/' + pageNum + '/' + pageSize,
    method:'get'
  })
}
// 通过文章ID获取文章内容
export function getArticleContent(articleId) {
  return request({
    url:'/article/content/' + articleId,
    method:'get'
  })
}

// 获取文章列表
export function getArticleList(pageNum,pageSize,searchMap) {
  return request({
    url:'/article/list/many/' + pageNum + '/' + pageSize,
    method:'post',
    data: searchMap
  })
}

// 保存文章
export function saveArticle(article) {
  return request({
    url: '/article',
    method: 'post',
    data:article
  })
}


// 删除文章
export function deleteArticle(articleId) {
  return request({
    url:'/article/' + articleId,
    method:'delete'
  })
}

// 修改文章状态
export function updateArticleStatus(articleId,status) {
  return request({
    url:'/article/' + articleId,
    method:'put',
    data:status
  })
}

// 更新文章
export function updateArticle(articleId,article) {
  return request({
    url:'/article/' + articleId,
    method:'put',
    data:article
  })
}

